import {
    List
} from 'zbee-store' ;
export default () => {
    var {
        data,
        load,
        reload,
        loadData
    } = List({
        idProperty:'id',
        data:[{
            id:1,
            name: 'admin',
            category:'图纸名称A',
            device: ['设备A','设备B','设备C','设备D',],
            createdMethod: ['工艺A','工艺B','工艺C','工艺D',],
            material: ['材料A','材料B','材料C','材料D'],
            unitPrice: ['相关销子A','相关销子B','相关销子C'],
            nums:1,
            totalPrice:'¥800',
        },{
            id:2,
            name: 'admin',
            category:'图纸名称A',
            device: ['设备A','设备B','设备C','设备D',],
            createdMethod: ['工艺A','工艺B','工艺C','工艺D',],
            material: ['材料A','材料B','材料C','材料D'],
            unitPrice: ['相关销子A','相关销子B','相关销子C','相关销子D'],
            nums:1,
            totalPrice:'¥800',
        },{
            id:3,
            name: 'admin',
            category:'图纸名称A',
            device: ['设备A','设备B','设备C','设备D',],
            createdMethod: ['工艺A','工艺B','工艺C','工艺D',],
            material: ['材料A','材料B','材料C','材料D'],
            unitPrice: ['相关销子A','相关销子B','相关销子C','相关销子D'],
            nums:1,
            totalPrice:'¥800',
        },{
            id:4,
            name: 'admin',
            category:'图纸名称A',
            device: ['设备A','设备B','设备C','设备D',],
            createdMethod: ['工艺A','工艺B','工艺C','工艺D',],
            material: ['材料A','材料B','材料C','材料D'],
            unitPrice: ['相关销子A','相关销子B','相关销子C','相关销子D'],
            nums:1,
            totalPrice:'¥800',
        },{
            id:5,
            name: 'admin',
            category:'图纸名称A',
            device: ['设备A','设备B','设备C','设备D',],
            createdMethod: ['工艺A','工艺B','工艺C','工艺D',],
            material: ['材料A','材料B','材料C','材料D'],
            unitPrice: ['相关销子A','相关销子B','相关销子C','相关销子D'],
            nums:1,
            totalPrice:'¥800',
        }]
        })
    return {
        data,
        load,
        reload,
        loadData,
        delete(param){
        for(var i = 0; i < data.value.length ;i++)
        {
            if(data.value[i].id === param.id)
            {
                data.value.splice(i,1)
            }
        }
        load(data.value)
        },

        search(param){
            let temp = [];
            alert("目前只支持类别搜索！")
            for(var i = 0; i < data.value.length ;i++)
            {
                if(data.value[i].type === param.modelValue)
                {
                    temp.push(data.value[i])
                }
            }
            data.value = temp
            load(data.value)
            
        }
    }
}
